#pragma once
#include "Common.h"
#include "CentralCache.h"
#include "ObjectPool.h"

class ThreadCache
{
public:
	ThreadCache()
	{}
	void* Alloc(size_t size);
	void Dealloc(void* ptr, size_t size);
	void* FetchFromCentral(size_t index, size_t size);
	void ListTooLong(FreeList& list, size_t size);
private:
	FreeList _freeLists[NFREELIST];
};

static _declspec(thread) ThreadCache* _pTLSThreadCache = nullptr;
static ObjectPool<ThreadCache> _threadCachePool;